# -*- coding: utf-8 -*-
from db.mysql import MysqlClient
from common.helper import Helper
from itertools import product

name = "e行大地-交通工具意外"
prices = ["29.50","66.10"]
plan = {
    "planA": {
        "days": ["1y"],
        "people_count": ['1'],
        "airplane_death": ["100000"],
        "ship_death": ["100000"],
        "train_death": ["100000"],
        "bus_death": ["100000"],
        "taxi_death": ["100000"],
        "passenger_death": ["100000"]

    },
    "planB": {
        "days": ["1y"],
        "people_count": ['1'],
        "airplane_death": ["300000"],
        "ship_death": ["300000"],
        "train_death": ["300000"],
        "bus_death": ["300000"],
        "taxi_death": ["300000"],
        "passenger_death": ["200000"]
    }
}
num = 0
mysql = MysqlClient()
for k in plan:
    for v in product(plan[k]["days"],plan[k]["people_count"],plan[k]["airplane_death"],plan[k]["ship_death"],plan[k]["train_death"],plan[k]["bus_death"],plan[k]["taxi_death"],plan[k]["passenger_death"]):
        data = Helper.formatProductInfo( plan[k],v )
        data["price"] = prices[num]
        num += 1
        data["name"] = name
        data["company"] = "中国大地保险"
        Helper.mergeTable( name,mysql,data)
